<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('资产管理列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>资产状态：</label>
                                <select name="zichanzhuangtai" th:with="type=${@dict.getType('biz_zichanzhuangtai')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>资产编号：</label>
                                <input type="text" name="zichanbianhao"/>
                            </li>
                            <li>
                                <label>资产名称：</label>
                                <input type="text" name="zichanmingcheng"/>
                            </li>
                            <li>
                                <label>教育分类：</label>
                                <select name="jiaoyufenlei" th:with="type=${@dict.getType('biz_jiaoyufenlei')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>财政分类：</label>
                                <select name="caizhengfenlei" th:with="type=${@dict.getType('biz_caizhengfenlei')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>使用部门：</label>
                                <select name="shiyongbumen" th:with="type=${@dict.getType('biz_shiyongbumen')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>使用人：</label>
                                <select name="shiyongren" th:with="type=${@dict.getType('biz_caiwufuzeren')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>管理部门：</label>
                                <select name="guanlibumen" th:with="type=${@dict.getType('biz_shiyongbumen')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>存放地点：</label>
                                <select name="cunfangdidian" th:with="type=${@dict.getType('biz_cunfangdidian')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>RFID编号：</label>
                                <input type="text" name="rfid"/>
                            </li>
                            <li>
                                <label>打印次数：</label>
                                <input type="text" name="rfiddayincishu"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:zichan:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:zichan:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:zichan:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="system:zichan:import">
                    <i class="fa fa-upload"></i> 导入
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:zichan:export">
                    <i class="fa fa-download"></i> 打印条码
                </a>
                <a class="btn btn-warning" onclick="exportZichan()" shiro:hasPermission="system:zichan:export">
                    <i class="fa fa-download"></i> 资产导出
                </a>

            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" style="word-break:keep-all"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:zichan:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:zichan:remove')}]];
        var zichanzhuangtaiDatas = [[${@dict.getType('biz_zichanzhuangtai')}]];
        var jiaoyufenleiDatas = [[${@dict.getType('biz_jiaoyufenlei')}]];
        var caizhengfenleiDatas = [[${@dict.getType('biz_caizhengfenlei')}]];
        var jiliangdanweiDatas = [[${@dict.getType('biz_jiliangdanwei')}]];
        var qudefangshiDatas = [[${@dict.getType('biz_qudefangshi')}]];
        var peizhipizhundanweiDatas = [[${@dict.getType('biz_peizhipizhundanwei')}]];
        var danweikuaijikemuDatas = [[${@dict.getType('biz_danweikuaijikemu')}]];
        var caigouzuzhixingshiDatas = [[${@dict.getType('biz_caigouzuzhixingshi')}]];
        var jiazhileixingDatas = [[${@dict.getType('biz_jiazhileixing')}]];
        var caiwuruzhangzhuangtaiDatas = [[${@dict.getType('biz_caiwuruzhangzhuangtai')}]];
        var zhejiutanxiaofangfaDatas = [[${@dict.getType('biz_zhejiutanxiaofangfa')}]];
        var caiwufuzerenDatas = [[${@dict.getType('biz_caiwufuzeren')}]];
        var shiyongzerenzhutiDatas = [[${@dict.getType('biz_shiyongzerenzhuti')}]];
        var shiyongbumenDatas = [[${@dict.getType('biz_shiyongbumen')}]];
        var shiyongrenDatas = [[${@dict.getType('biz_caiwufuzeren')}]];
        var guanlibumenDatas = [[${@dict.getType('biz_shiyongbumen')}]];
        var guanlirenDatas = [[${@dict.getType('biz_caiwufuzeren')}]];
        var jingshourenDatas = [[${@dict.getType('biz_caiwufuzeren')}]];
        var shifougongxiangshiyongDatas = [[${@dict.getType('sys_yes_no')}]];
        var cunfangdidianDatas = [[${@dict.getType('biz_cunfangdidian')}]];
        var jingfeilaiyuanDatas = [[${@dict.getType('biz_jingfeilaiyuan')}]];
        var prefix = ctx + "system/zichan";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                importUrl: prefix + "/importData",
                modalName: "资产管理",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'sn',
                    title: '',
                    visible: false
                },
                {
                    title: '编辑',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.sn + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        return actions.join('');
                    }
                },
                {
                    title: '删除',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.sn + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                },
                {
                    field: 'xuhao',
                    title: '序号'
                },
                {
                    field: 'zichanzhuangtai',
                    title: '资产状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(zichanzhuangtaiDatas, value);
                    }
                },
                {
                    field: 'yanshoudanbianhao',
                    title: '验收单编号'
                },
                {
                    field: 'zichanbianhao',
                    title: '资产编号'
                },
                {
                    field: 'zichanmingcheng',
                    title: '资产名称'
                },
                {
                    field: 'jiaoyufenlei',
                    title: '教育分类',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(jiaoyufenleiDatas, value);
                    }
                },
                {
                    field: 'caizhengfenlei',
                    title: '财政分类',
                    width:'100px',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(caizhengfenleiDatas, value);
                    }
                },
                {
                    field: 'jiazhi',
                    title: '价值'
                },
                {
                    field: 'shuliang',
                    title: '数量'
                },
                {
                    field: 'jiliangdanwei',
                    title: '计量单位',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(jiliangdanweiDatas, value);
                    }
                },
                {
                    field: 'qudefangshi',
                    title: '取得方式',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(qudefangshiDatas, value);
                    }
                },
                {
                    field: 'peizhipizhundanwei',
                    title: '配置批准单位',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(peizhipizhundanweiDatas, value);
                    }
                },
                {
                    field: 'danweikuaijikemu',
                    title: '单位会计科目',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(danweikuaijikemuDatas, value);
                    }
                },
                {
                    field: 'xiangmudaima',
                    title: '项目代码'
                },
                {
                    field: 'caigouzuzhixingshi',
                    title: '采购组织形式',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(caigouzuzhixingshiDatas, value);
                    }
                },
                {
                    field: 'quderiqi',
                    title: '资产取得日期'
                },
                {
                    field: 'tourushiyongriqi',
                    title: '投入使用日期'
                },
                {
                    field: 'jiazhileixing',
                    title: '价值类型',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(jiazhileixingDatas, value);
                    }
                },
                {
                    field: 'caiwuruzhangzhuangtai',
                    title: '财务入账状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(caiwuruzhangzhuangtaiDatas, value);
                    }
                },
                {
                    field: 'jizhangriqi',
                    title: '资产记账日期'
                },
                {
                    field: 'jizhangpingzhenghao',
                    title: '记账凭证号'
                },
                {
                    field: 'caizhengbokuan',
                    title: '财政拨款'
                },
                {
                    field: 'feicaizhengbokuan',
                    title: '非财政拨款'
                },
                {
                    field: 'zhejiutanxiaofangfa',
                    title: '折旧/摊销方法',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(zhejiutanxiaofangfaDatas, value);
                    }
                },
                {
                    field: 'leijizhejiu',
                    title: '累计折旧/摊销'
                },
                {
                    field: 'jingzhi',
                    title: '净值'
                },
                {
                    field: 'caiwufuzeren',
                    title: '财务负责人',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(caiwufuzerenDatas, value);
                    }
                },
                {
                    field: 'shiyongzerenzhuti',
                    title: '使用责任主体',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(shiyongzerenzhutiDatas, value);
                    }
                },
                {
                    field: 'shiyongbumen',
                    title: '使用部门',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(shiyongbumenDatas, value);
                    }
                },
                {
                    field: 'shiyongren',
                    title: '使用人',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(shiyongrenDatas, value);
                    }
                },
                {
                    field: 'guanlibumen',
                    title: '管理部门',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(guanlibumenDatas, value);
                    }
                },
                {
                    field: 'guanliren',
                    title: '管理人',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(guanlirenDatas, value);
                    }
                },
                {
                    field: 'jingshouren',
                    title: '经手人',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(jingshourenDatas, value);
                    }
                },
                {
                    field: 'shifougongxiangshiyong',
                    title: '是否共享共用',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(shifougongxiangshiyongDatas, value);
                    }
                },
                {
                    field: 'cunfangdidian',
                    title: '存放地点',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(cunfangdidianDatas, value);
                    }
                },
                {
                    field: 'putongdayincishu',
                    title: '普通打印次数'
                },
                {
                    field: 'rfiddayincishu',
                    title: 'RFID打印次数'
                },
                {
                    field: 'pinpai',
                    title: '品牌'
                },
                {
                    field: 'guigexinghao',
                    title: '规格型号'
                },
                {
                    field: 'jingfeilaiyuan',
                    title: '经费来源',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(jingfeilaiyuanDatas, value);
                    }
                },
                {
                    field: 'createDate',
                    title: '资产录入日期'
                },
                {
                    field: 'rfid',
                    title: 'RFID'
                }]
            };
            $.table.init(options);
        });

        // 导出数据
        function exportZichan() {
            console.log(1111);
            var dataParam = $("#formId").serializeArray();
            console.log(dataParam);
            var tipMsg = "确定导出所有数据吗？";
            $.modal.confirm(tipMsg, function() {
                $.post(prefix + "/exportZichan", dataParam, function(result) {
                    if (result.code == web_status.SUCCESS) {
                        window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
                    } else {
                        $.modal.alertError(result.msg);
                    }
                });
            });
        }
    </script>
     <!-- 导入区域 -->
     <script id="importTpl" type="text/template">
         <form enctype="multipart/form-data" class="mt20 mb10">
             <div class="col-xs-offset-1">
                 <input type="file" id="file" name="file"/>
                 <!--            <div class="mt10 pt5">-->
                 <!--                <input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在，更新这条数据。"> 是否更新已经存在的用户数据-->
                 <!--                &nbsp;    <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>-->
                 <!--            </div>-->
                 <font color="red" class="pull-left mt10">
                     提示：1、仅允许导入“xls”或“xlsx”格式文件！
                     <br>2、存在的资产数据，则跳过。
                 </font>
             </div>
         </form>
     </script>
</body>
</html>